<%--
  Created by IntelliJ IDEA.
  User: hp
  Date: 2021/4/21
  Time: 22:06
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" isELIgnored="false" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0" />
    <title>学生列表</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/semantic.min.css">
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/css/manster.css"/>
</head>
<body>

<div class="ui attached pointing menu">
    <div class="ui container">
        <div class="right menu">
            <a href="${pageContext.request.contextPath}/add" class="active blue item">新增</a>
            <a href="${pageContext.request.contextPath}/list" class="item">列表</a>
        </div>
    </div>
</div>

<!-- 中间内容 -->
<div class="m-container-small m-padded-tb-large">
    <div class="ui container">
        <form action="${pageContext.request.contextPath}/save" method="post" class="ui form">
            <input type="hidden" name="id" value="${student.id}">
            <div class="field">
                <div class="ui left labeled input">
                    <label for="name" class="ui teal basic label">姓名</label>
                    <input type="text" id="name" name="name" placeholder="姓名" value="${student.name}">
                </div>
            </div>
            <div class="field">
                <div class="ui left labeled input">
                    <label for="age" class="ui teal basic label">年龄</label>
                    <input type="text" id="age" name="age" placeholder="年龄" value="${student.age}">
                </div>
            </div>
            <div class="field">
                <div class="ui left labeled action input">
                    <label class="ui compact teal basic label">性别</label>
                    <div class="ui fluid selection dropdown">
                        <input type="hidden" name="gender" value="${student.gender}">
                        <i class="dropdown icon"></i>
                        <div class="default text">性别</div>
                        <div class="menu">
                            <div class="item" data-value="男">男</div>
                            <div class="item" data-value="女">女</div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="field">
                <div class="ui left labeled input">
                    <label for="number" class="ui teal basic label">学号</label>
                    <input type="text" id="number" name="number" placeholder="学号" value="${student.number}">
                </div>
            </div>
            <div class="field">
                <div class="ui left labeled input">
                    <label for="address" class="ui teal basic label">地址</label>
                    <input type="text" id="address" name="address" placeholder="地址" value="${student.address}">
                </div>
            </div>
            <div class="field">
                <div class="ui left labeled action input">
                    <label class="ui compact teal basic label">状态</label>
                    <div class="ui fluid selection dropdown">
                        <input type="hidden" name="status" value="${student.status}">
                        <i class="dropdown icon"></i>
                        <div class="default text">状态</div>
                        <div class="menu">
                            <div class="item" data-value="正常">正常</div>
                            <div class="item" data-value="休学">休学</div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="ui error message"></div>

            <!-- 操作 -->
            <div class="ui right aligned container">
                <button type="button" class="ui button" onclick="window.history.go(-1)">返回</button>
                <button type="submit" class="ui blue button">保存</button>
            </div>

        </form>
    </div>
</div>

<script src="${pageContext.request.contextPath}/static/js/jquery-3.3.1.js"></script>
<script src="${pageContext.request.contextPath}/static/js/semantic.min.js"></script>
<script>
    // 下拉
    $('.ui.dropdown').dropdown({
        on : 'hover'
    });
    //form验证
    $('.ui.form').form({
        fields : {
            name : {
                identifier : 'name',
                rules : [{
                    type : 'empty',
                    prompt : '姓名：请输入学生姓名'
                }]
            },
            age : {
                identifier : 'age',
                rules : [{
                    type : 'empty',
                    prompt : '年龄：请输入学生年龄'
                }]
            },
            gender : {
                identifier : 'gender',
                rules : [{
                    type : 'empty',
                    prompt : '性别：请选择学生性别'
                }]
            },
            number : {
                identifier : 'number',
                rules : [{
                    type : 'empty',
                    prompt : '学号：请输入学生学号'
                }]
            },
            address : {
                identifier : 'address',
                rules : [{
                    type : 'empty',
                    prompt : '地址：请输入学生住址'
                }]
            },
            status : {
                identifier : 'status',
                rules : [{
                    type : 'empty',
                    prompt : '状态：请输入学生状态'
                }]
            }
        }
    });
</script>
</body>
</html>
